<?php
namespace Admin\Model;
use Think\Model;
class UsersModel extends Model {
    public function search()
    {  
        /*************搜索*********************/
        $keyword = I('get.keyword');
        $where = array();
        $where['is_delete'] = 0;
        if($keyword)
        {
            $where['nickname'] = array('like','%'.$keyword.'%');
        }

        $data = $this->where($where)->order('id asc')->select();
        foreach($data as $k=>&$v){
            $v['account'] = substr_replace($v['account'],'****',3,4);
            if($v['partner_id'] != 0){
                $partner = D('Partners')->where('id='.$v['partner_id'])->getField('nickname'); 
                $v['partner'] = $partner; 
            }   
        }
        //var_dump($data);die;
        return array(
            'users'     =>  $data,

            );
    }

}